<?php echo $this->Html->script(array('print')); ?>

<div class="widget">

    <div class="whead"><h6>VISTA DE IMPRESION</h6><div class="clear"></div></div>
    <fieldset>
        <div id="areaImprimir">
            <table>
                <tr>
                    <td>
                        <?php echo $this->Html->image('epcm/logo1.png') ?>    
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td>
                        <h4>
                            <strong><?php echo $this->Session->read('Auth.User.Sucursale.nombre') ?></strong>
                        </h4>
                    </td>

                </tr>
                <tr>
                    <td>
                        <h6>
                            <strong style="color: #A64949">                               
                                NRO DE REGISTRO :
                                <?php echo $nota['Cortestubo']['id']; ?>
                            </strong>
                        </h6>
                    </td>
                    <td colspan="2">
                        <h5>
                            <strong class="green">
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                                
                                <?php if ($nota['Cortestubo']['ne'] == 1){
                                    $nombrenota = 'NOTA DE ENTREGA';
                                }
                                if($nota['Cortestubo']['nv'] == 1){
                                    $nombrenota = 'NOTA DE VENTA';  
                                }
                                ?> 
                                <?php echo $nombrenota;?>                             
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </strong>
                        </h5>
                    </td>
                    
                </tr>                
                <tr>
                    <td>
                        <h5>
                            Se&ntilde;or(es) : &nbsp;&nbsp;
                            <span>
                            <?php echo $nota['Cortestubo']['cliente']; ?>
                        </span>
                        </h5>
                    </td>
                    <td>
                        
                    </td>
                    <td colspan="2">
                        <h5>
                        FECHA:
                        <?php
                            echo date('d-m-y');
                        ?>
                        </h5>
                    </td>
                </tr>
            </table> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tLight">
                <thead>
                    <tr>
                        <th>Producto</th>
                        <th>Codigo</th>
                        <?php if ($nota['Cortestubo']['alto'] != null):?>
                            <th>Alto</th>
                        <?php endif;?>
                        <th>Peso</th>
                        <th>Precio</th>
                        <th>Propietario</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><?php 
                            echo $nota['Tubo']['nombre'];
                        ?></td>
                        <td><?php echo $nota['Cortestubo']['codigo']?></td>
                        <?php if ($nota['Cortestubo']['alto'] != null):?>
                            <td><?php echo $nota['Cortestubo']['alto'];?></td>
                        <?php endif;?>
                        <td><?php echo $nota['Cortestubo']['peso'];?></td>
                        <td><?php echo $nota['Cortestubo']['precio'];?></td>
                        <td><?php echo $nota['Cortestubo']['propietario'];?></td>
                    </tr>
                </tbody>
            </table>
        </div>
    </fieldset>
</div>
<table>
    <tr>
        <td> 
        <a class="buttonM bBlack" href="#" id="btnImprimir">IMPRIMIR</a>
        </td>
        <td><?php echo $this->Html->link('ATRAS',array('controller'=>'Tubos','action' => 'verdetalle',$idTubo),array('class'=>'buttonM bGreen'))?></td>
        
        
    </tr>

</table>
<script type="text/javascript">

    $(document).ready(function() {

        $("#btnImprimir").click(function() {
            //console.log('click');
            printElem({
                leaveOpen: true,
                printMode: 'popup',
                overrideElementCSS: [
                    '<?php echo $this->webroot; ?>css/imprimir.css',
                    {href: '<?php echo $this->webroot; ?>css/imprimir.css', media: 'print'}]
            });
            //printElem({ overrideElementCSS: ['http://www.imprenta.com/css/printable.css'] });
        });

    });
    function printElem(options) {
        $('#areaImprimir').printElement(options);
    }
</script>